﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VipSoft.Core.Dao;
using VipSoft.Core.Entity;
using VipSoft.Core.Service;
using VipSoft.Core.Utility;

namespace VipSoft.Service
{
    public abstract class VipSoftService<T> : IService<T>
    {
        public abstract IDao<T> Dao { get; }
         

        public virtual int Add(IEntity entity)
        {
            return Dao.Add(entity);
        }

        public virtual int BatchInsert(List<IEntity> entity)
        {
            return Dao.BatchInsert(entity);
        }

        public virtual int Delete(params object[] key)
        {
            return Dao.Delete(key);
        }

        public virtual int Delete(Criteria criteria)
        {
            return Dao.Delete(criteria);
        }

        public virtual int Update(IEntity entity)
        {
            return Dao.Update(entity);
        }

        public virtual T Get(object key)
        {
            return Dao.Get(key);
        }
         

        public virtual T Get(Criteria criteria)
        {
            return Dao.Get(criteria);
        }

        public virtual List<T> GetList()
        {
            return Dao.GetList();
        }

        public virtual List<T> GetList(IEntity entity)
        {
            return Dao.GetList(entity);
        }

        public virtual List<T> GetList(Criteria criteria, params Order[] order)
        {
            return Dao.GetList(criteria, order);
        }

        public virtual List<T> GetPageList(int pageSize, int dataStart, out int totalItemCount, Criteria criteria, params Order[] order)
        {
            return Dao.GetPageList(pageSize, dataStart, out totalItemCount, criteria, order);
        }

        public virtual List<T> GetCacheList()
        {
            return Dao.GetCacheList();
        }

    }
}
